Back to course home
0% completed
Vote For New Content
Google Hard
Shortest Subarray with Sum at Least K (hard)
Solution: Shortest Subarray with Sum at Least K
Reverse Pairs (hard)
Solution: Reverse Pairs
Nth Magical Number (hard)
Solution: Nth Magical Number
Candy (hard)
Solution: Candy
Arithmetic Slices II - Subsequence (hard)
Solution: Arithmetic Slices II - Subsequence
Burst Balloons (hard)
Solution: Burst Balloons
Sum of Distances in Tree (hard)
Solution: Sum of Distances in Tree
Maximum Score of a Good Subarray (hard)
Solution: Maximum Score of a Good Subarray
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Minimum Area Rectangle (medium)
Problem Statement
Given an array of points in the X-Y plane points where points[i] = [xi, yi], return the minimum area of a rectangle formed from these points. The sides of the rectangle should be parallel to the X and Y axes. If there is not any such rectangle, return 0.
Examples
-
Example 1:
- Input:: points =
[[1,2],[2,1],[1,0],[0,1]] - Expected Output::
0 - Justification:: There are no four points that can form a rectangle with sides parallel to the axes, so the minimum area is 0.
- Input:: points =
-
Example 2:
- :Input:: points =
[[0,1],[0,3],[3,1],[3,3],[4,1],[4,3]] - :Expected Output::
2 - :Justification:: These points form a rectangle with corners at
[3,1],[4,1],[4,3], and[3,3]. This rectangle's area is 2, making it the smallest possible area from these points.
- :Input:: points =
-
Example 3:
- :Input:: points =
[[1,1],[2,2],[3,3]] - :Expected Output::
0 - :Justification:: There are no four points that can form a rectangle with sides parallel to the axes, so the minimum area is 0.
- :Input:: points =
Try it yourself
Try solving this question here:
Java
Saved to Cloud
. . . .
Solution: Maximum Length of Semi-Decreasing Subarrays
Solution: Minimum Area Rectangle
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself